<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="" />
    <meta name="description" content=""/>
    <style type="text/css">
		#box{
			width: 500px;
			height: 300px;
			border: 1px solid orange;
			line-height: 15px;
			color: red;
			font-size: 15px;
		}
		#liuyan{
			width: 500px;
			height: 80px;
			border: 1px solid orange;
		}
		#btn{
			display: block;		
		}
    </style>
    <script type="text/javascript">
  		window.onload = function(){
  			var liuyan = document.getElementById('liuyan')
  			var btn = document.getElementById('btn');
  			var box = document.getElementById('box');
  			btn.onclick = function(){
  				var txt = liuyan.value;
  				if(txt == "")
  				{
  					alert("请输入留言信息");
  					return;
  				}
  				var newP = document.createElement('p');
  				newP.innerHTML = txt;
  				liuyan.value = "";
  				box.appendChild(newP);
  			}
  		}
    </script>
    <title>留言板</title>
  </head>

 <body>
	<div id="box">
		
	</div>
	<textarea id="liuyan" cols="30" rows="10"></textarea>
	<input type="button" value="提交留言" id="btn" />
 </body>
</html>